package com.fr.chart.axis;

import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.DataSeriesCondition;
import com.fr.chart.base.equals.Equals;
import com.fr.chart.core.ChartUtils;
import com.fr.util.Utils;
import java.awt.Color;

public class SeriesAttrBorder
  implements DataSeriesCondition
{
  private static final long serialVersionUID = -3059717142253632161L;
  public static final String XML_TAG = "SeriesAttrBorder";
  private Color borderColor = Color.black;
  private int borderStyle = 0;
  private boolean isRoundBorder = false;

  public void setBorderColor(Color paramColor)
  {
    this.borderColor = paramColor;
  }

  public Color getBorderColor()
  {
    return this.borderColor;
  }

  public void setBorderStyle(int paramInt)
  {
    this.borderStyle = paramInt;
  }

  public int getBorderStyle()
  {
    return this.borderStyle;
  }

  public void setRoundBorder(boolean paramBoolean)
  {
    this.isRoundBorder = paramBoolean;
  }

  public boolean isRoundBorder()
  {
    return this.isRoundBorder;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if (str1.equals("Attr"))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("lineStyle")) != null)
          setBorderStyle(Utils.string2Number(str2).intValue());
        if ((str2 = paramXMLableReader.getAttr("lineColor")) != null)
          setBorderColor(new Color(Utils.string2Number(str2).intValue(), true));
        if ((str2 = paramXMLableReader.getAttr("isRoundBorder")) != null)
          setRoundBorder(Boolean.valueOf(str2).booleanValue());
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("SeriesAttrBorder");
    paramXMLPrintWriter.startTAG("Attr").attr("lineStyle", this.borderStyle);
    if (this.borderColor != null)
      paramXMLPrintWriter.attr("lineColor", this.borderColor.getRGB());
    paramXMLPrintWriter.attr("isRoundBorder", this.isRoundBorder);
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof SeriesAttrBorder))
      return false;
    SeriesAttrBorder localSeriesAttrBorder = (SeriesAttrBorder)paramObject;
    if ((localSeriesAttrBorder.borderStyle != this.borderStyle) || (localSeriesAttrBorder.isRoundBorder != this.isRoundBorder))
      return false;
    return (Equals.equals(localSeriesAttrBorder.borderColor, this.borderColor));
  }

  public JSONObject toJSONObject()
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("borderStyle", this.borderStyle);
    localJSONObject.put("isRoundBorder", this.isRoundBorder);
    if (this.borderColor != null)
      localJSONObject.put("borderColor", ChartUtils.color2JS(this.borderColor));
    return localJSONObject;
  }

  public String getConditionType()
  {
    return "SeriesAttrBorder";
  }
}